package com.demo;

public class MethodDemo5 {
    public static void main(String[] args) {
        //目标:掌握带返回值方法的定义和调用格式

        //直接调用
        getSum(10.2,20.3,30.4);

        //赋值调用
        double sum=getSum(10.2,20.3,30.6);
        System.out.println("sum="+sum);

        //输出调用
        System.out.println("sum="+getSum(10.2,20.3,40.8));


        //计算第一个季度的营业额
        double sum1=getSum(10.2,20.3,30.4);
        //计算第二个季度的营业额
        double sum2=getSum(20.3,30.4,40.5);
        //计算第三个季度的营业额
        double sum3=getSum(30.4,40.5,50.6);
        //计算第四个季度的营业额
        double sum4=getSum(40.5,50.6,60.7);

        //求全年的总营业额
        double total=sum1+sum2+sum3+sum4;
        System.out.println("total="+total);
    }
    public static double getSum(double num1,double num2,double num3){
        double result=num1+num2+num3;
        return result;
    }
}
